package cate.game.role.res.formations.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBFormations;
import cate.game.res.CostSelect;
import easy.java.dev.note.NoteField;

import java.util.Map;

@ClientMsg(title = "阵法激活的请求")
@OperationSetter(value = GDOperation.FORMATIONS_ACTIVE, sub = "tid")
public class FormationActiveReq implements MsgInput {
    @NoteField("阵法id")
    public int tid;

    @NoteField("消耗英雄")
    public Map<Integer, CostSelect> csMap;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = cc.getRole().getRes().formations.activeFormation(tid, csMap);
        game.notice.message(cc.getRole(), r, true);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBFormations.ACTIVE_REQ;
    }
}
